package main

import "fmt"

func main() {
	//数组指针
	var arr1 = [4]int{1, 2, 3, 4}
	var p1 *[4]int
	p1 = &arr1

	fmt.Printf("p1 的地址：%p\n", p1)
	fmt.Printf("p1 自己的地址：%p\n", &p1)
	fmt.Printf("p1 所指向的地址的值：%p\n", *p1)

	(*p1)[0] = 100
	fmt.Println(arr1)
	fmt.Println(*p1)

	//简化写法
	p1[0] = 200
	fmt.Println(arr1)

	//指针数组
	a := 1
	b := 2
	c := 3
	d := 4

	arr2 := [4]*int{&a, &b, &c, &d}

	fmt.Println(arr2)

	*arr2[0] = 500
	fmt.Println(a)

	a = 200
	fmt.Println(*arr2[0])
}
